package com.xbongbong.pro.statistic.through.pojo;

import com.xbongbong.pro.enums.SaasMarkEnum;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.util.Objects;

/**
 * 表格内数据属性
 * @author zcp
 * @version v1.0
 * @date 2019/4/25 20:00
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class TableDataInfoPojo implements Serializable {
    private static final long serialVersionUID = -3736592377242149772L;

    /**
     * 显示值
     */
    private String value;

    /**
     * 是否可穿透，0否，1是，默认为0不可穿透
     */
    private Integer throughFlag;

    /**
     * 系统指标穿透的业务类型,@see XbbRefTypeEnum，默认为null
     */
    private Integer businessType;

    /**
     * 穿透的业务id，默认为null
     */
    private Long dataId;

    /**
     * saas标记
     */
    private Integer saasMark;

    public TableDataInfoPojo(String value) {
        this.value = value;
    }

    public TableDataInfoPojo(String value, Integer throughFlag, Integer businessType, Long dataId) {
        this.value = value;
        this.throughFlag = throughFlag;
        this.businessType = businessType;
        this.dataId = dataId;
        this.saasMark = SaasMarkEnum.SAAS.getCode();
    }

    public TableDataInfoPojo(String value, Integer throughFlag, Integer businessType, Long dataId,Integer saasFlag) {
        this.value = value;
        this.throughFlag = throughFlag;
        this.businessType = businessType;
        this.dataId = dataId;
        //saasFlag 即 businessTpe = 0 时，为自定义表单，否则为系统表单
        this.saasMark = Objects.equals(saasFlag, 0) ? SaasMarkEnum.PAAS.getCode() : SaasMarkEnum.SAAS.getCode();
    }
}
